package com.lai.shop.controller;

import com.lai.shop.entity.ProductEntity;
import com.lai.shop.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class ProductWebController {


    @Autowired
    ProductService productService;


    @RequestMapping("/goods/detail")
    public String getGoodsDetailById(@RequestParam("id") Long id,Model model){
        ProductEntity product = productService.getGoodsDetailById(id);
        model.addAttribute("product",product);
        return "product";
    }



}
